Skip to content

buildingplan: fix roller chain estimate - #5919

Merged
ab9rf merged 3 commits into
DFHack:developfrom
Alistair-Afton:fix-roller-chain-estimate
Sep 17, 2026
Merged

ab9rf merged 3 commits into
DFHack:developfrom
Alistair-Afton:fix-roller-chain-estimate

Conversation

@Alistair-Afton

Copy link
Copy Markdown
Contributor

Summary

Fixes #5778

The planner's get_quantity multiplied any positive filter quantity by the selected area's volume. For a roller that made the chain estimate scale with length (e.g. 9 chains for a 9-tile roller) when the job always needs exactly 1 chain.

Job item quantities are totals for the whole building job. Per-area scaling is only expressed by the quantity = -1 sentinel (tiles/4 + 1, used by the roller mechanism, bridge, paved road, and horizontal axle filters) and by constructions, which count placeable tiles on their own code path. The final quantity * volume fallback therefore only ever fired for the roller's chain filter; it now returns the quantity as-is.

Testing

Verified in a live fort by driving buildreq and calling the module's internals:

  • 9-tile horizontal roller (direction=1): 3 Mechanisms, 1 Chain — was 9 Chains before the fix.
  • 5x5 trade depot: 3 boulders, unchanged.
  • 3x2 wall selection on the surface: still counts only placeable tiles.

The planner multiplied positive job item quantities by the selected
area's volume, so a 9-tile roller asked for 9 chains. Job item
quantities are totals for the whole building job: rollers always need
exactly 1 chain (plus tiles/4+1 mechanisms via the quantity=-1
sentinel). Only constructions keep the per-tile count, which already
has its own path.

Fixes DFHack#5778
Comment thread docs/changelog.txt
- `aquifer`: make ``--skip-top`` and top-relative ``--levels`` take effect for the ``drain``, ``convert``, and ``add`` actions instead of being silently ignored
- `autodump`: ``destroy`` no longer leaves the contents of destroyed containers in limbo or crashes when destroying unit-held items
- `timestream`: deal properly with units who have breathing difficulties
- `buildingplan`: fix roller material estimate asking for one chain per tile instead of one chain total

@ab9rf ab9rf Sep 17, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: I prefer that changelog entries be in alphabetical order by affected tool. Will fix this one myself this time, and need to remind myself to update our contribution standards

@ab9rf
ab9rf merged commit ca5ee78 into DFHack:develop Sep 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: buildingplanner roller material estimate incorrect

2 participants